package com.bestsoft.web.controller.flow;

import com.bestsoft.common.core.controller.BaseController;
import com.bestsoft.common.core.domain.AjaxResult;
import com.bestsoft.common.core.page.TableDataInfo;
import com.bestsoft.flow.domain.FlowOrderMt;
import com.bestsoft.flow.domain.FlowOrderMt2;
import com.bestsoft.flow.service.IFlowOrderMtService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用户订单汇总Controller
 *
 * @author 王识宇
 * @date 2023-08-29
 *1
 */
@RestController
@RequestMapping("/flow/mt")
public class FlowOrderMtController extends BaseController{

    @Autowired
    private IFlowOrderMtService flowOrderMtService;

    /**
     * 查询用户订单汇总列表
     */
    @PreAuthorize("@ss.hasPermi('flow:mt:list')")
    @GetMapping("/list")
    public TableDataInfo list(FlowOrderMt flowOrderMt)
    {
        startPage();
        List<FlowOrderMt> list = flowOrderMtService.selectFlowOrderMtList(flowOrderMt);
        return getDataTable(list);
    }

    /**
     * 获取用户订单汇总详细信息
     */
    @PreAuthorize("@ss.hasPermi('flow:mt:query')")
    @GetMapping(value = "/{orderId}")
    public AjaxResult getInfo(@PathVariable("orderId") Long orderId)
    {
        return success(flowOrderMtService.selectFlowOrderMtByOrderId(orderId));
    }

    /**
     * 查询用户订单汇总列表erp
     */
    @PreAuthorize("@ss.hasPermi('flow:mt:list2')")
    @GetMapping("/list2")
    public TableDataInfo list2(FlowOrderMt2 flowOrderMt)
    {
        startPage();
        List<FlowOrderMt2> list = flowOrderMtService.selectFlowOrderMtListErp(flowOrderMt);
        return getDataTable(list);
    }

    /**
     * 获取用户订单汇总详细信息erp
     */
    @PreAuthorize("@ss.hasPermi('flow:mt:query2')")
    @GetMapping(value = "/{orderId2}")
    public AjaxResult getInfo2(@PathVariable("orderId2") Long orderId)
    {
        return success(flowOrderMtService.selectFlowOrderMtByOrderIdErp(orderId));
    }

}
